/*
 * gAlarm.java
 *
 * Created on October 30, 2007, 11:51 AM
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

/**
 *
 * @author drew
 */
import java.awt.*;
import javax.swing.*;
import java.util.*;
public class gAlarm extends JFrame
{
	AlarmEventsPanel eventsPanel;
	AlarmEventsScrollPane eventsScrollPane;
	Alarm main;
	
	/** Creates a new instance of gAlarm */
	public gAlarm ()
	{
		super("gAlarm");
		this.setDefaultCloseOperation (this.EXIT_ON_CLOSE);
		this.setBounds (300,300,500,400);
		this.getContentPane ().setLayout (null);
		this.setVisible (true);
		this.setResizable (false);
		
		// ========================= INSERT CODE HERE ==========================
		
		init();
		addButton();
		addAlarmEventsScrollPane();
		addSomeAlarms();
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		// ======================== END OF INSERTED CODE =======================
		
		this.validate ();
		this.repaint ();
	}
	
	
	public void init()
	{
		this.main  = new Alarm();
		this.eventsPanel = new AlarmEventsPanel(main.getEvents ());
		this.eventsScrollPane = new AlarmEventsScrollPane(this.eventsPanel);
	}
	
	
	public void addButton()
	{
		AddAlarmButton addAlarm = new AddAlarmButton();
		addAlarm.setBounds (10,310, 470, 50);
		this.getContentPane ().add (addAlarm);
	}
	
	
	public void addAlarmEventsScrollPane()
	{
		this.eventsScrollPane.setBounds (10, 10, 470, 290);
		this.eventsScrollPane.setViewportView (this.eventsPanel);
		this.add (this.eventsScrollPane);
	}
	
	public void addSomeAlarms()
	{
		AlarmEvent x1 = new AlarmEvent(new GregorianCalendar(2007, 9, 29, 14, 24), "HELLO", "WAKE UP FREEEEEEEED");
		main.addEvent(x1);
		AlarmEvent x2 = new AlarmEvent(new GregorianCalendar(2007, 9, 29, 14, 22), "HELLO", "WAKE UP FREEEEEEEEDssssssssss");
		main.addEvent(x2);
		
		AlarmEvent x3 = new AlarmEvent(new GregorianCalendar(2007, 9, 29, 14, 24), "HELLO", "WAKE UP FREEEEEEEED");
		main.addEvent(x3);
		AlarmEvent x4 = new AlarmEvent(new GregorianCalendar(2007, 9, 29, 14, 22), "HELLO", "WAKE UP FREEEEEEEEDssssssssss");
		main.addEvent(x4);
		
		this.eventsPanel.readraw ();
		//this.eventsScrollPane.repaint ();
	}
	
}
